package afternoon;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Try_Catch01 {



    public static void main(String[] args) {

        System.out.println("亲请输入一个除数");
        while (true){

            try {
                Scanner scanner = new Scanner(System.in);
                int i = scanner.nextInt();
                int  i1 = 1/i;
                System.out.println("结果是"+i1);
                break;

            } catch (ArithmeticException e) {

                System.out.println("除零异常.请重新输入");

            }catch (InputMismatchException e){
                System.out.println("你输入的不正确,请重新输入");
            }

        }
    }







}
